ios 开发百度地图的使用 |
您所在的位置:网站首页 › 高德 mapview › ios 开发百度地图的使用 |
isLoadingMap=2;
if(!_endCoordainateXText ||!_endCoordainateYText )isLoadingMap=1; NSArray* array = [NSArray arrayWithArray:_mapView.annotations]; [_mapView removeAnnotations:array]; array = [NSArray arrayWithArray:_mapView.overlays]; [_mapView removeOverlays:array]; CLLocationCoordinate2D startPt = (CLLocationCoordinate2D){0, 0}; CLLocationCoordinate2D endPt = (CLLocationCoordinate2D){0, 0}; if (_startCoordainateXText && _startCoordainateYText ) { startPt = (CLLocationCoordinate2D){_startCoordainateYText ,_startCoordainateXText }; } if (_endCoordainateYText && _endCoordainateXText ) { endPt = (CLLocationCoordinate2D){ _endCoordainateYText ,_endCoordainateXText}; } BMKPlanNode* start = [[BMKPlanNode alloc]init]; start.pt = startPt; start.name = nil; BMKPlanNode* end = [[BMKPlanNode alloc]init]; end.pt = endPt; end.name = nil; BOOL flag = [_search drivingSearch:nil startNode:start endCity:nil endNode:end]; if (!flag) { NSLog(@"search failed"); } [start release]; [end release]; [self Region]; } 2. 在其他软件中打开百度地图,并在百度软件中实现导航,搜索等。 在这里仅仅实现打开百度地图,如果打不开,则跳到App Store下载百度地图软件。 判断能否打开URL,能打开就打开,不能打开就跳转到百度地图,可能有的同学要做一打开百度地图就导航,或者显示搜索到的关键字的结果。这个就是改下下面代码中的的 stringURL, 带什么参数,需要对照百度协议,打开 http://developer.baidu.com/map/uri-introios.htm对照协议。 NSString *stringURL = [ NSString stringWithFormat : @"mapbarnaviiap:" ]; NSURL *url = [NSURL URLWithString:stringURL]; if ([[UIApplication sharedApplication] canOpenURL:url]) { [[UIApplication sharedApplication] openURL:url]; }else{ UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"提示" message:@"您未安装百度地图,是否立即前往APPStore安装!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"立即安装",@"稍后安装", nil]; [alert show]; [alert release]; } 问题在于申请的key。 之前申请可能不需要完整的签名,现在需要完整的签名才行。简单点说,之前申请叫cscapp就ok。现在申请需要com.calinks.cscapp。这个名字必须跟Bundle Identifer完全相同才能通过百度秘要。 B6258A4A5FFEE50A734B7FAACF104831A18C177A tie4cZmrsLkUAdjpOGFvQHfG 让我纠结的事情又发生了,用上面的key,百度地图提示keyStatus = 40002,百度再次更新key的管理机制,我只想说:坑爹~!。新key注册地址 http://lbsyun.baidu.com/apiconsole/key 而且百度不提供老版本sdk下载了,只能下载矢量地图。但是老版本的sdk依然可以使用。 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |